home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / (A)U / (A)U2.ADF / DataToObj / Readme < prev    next >
Text File  |  1989-06-03  |  2KB  |  69 lines

  1.                              DataToObject
  2.           Program to convert raw data files into object modules
  3.                       Written by Werner Gunther
  4.                             Public Domain
  5.  
  6.  Normally, when you need to access data (sprites, image data, a long text)
  7. from C or from assembler, you have to convert your data file into source
  8. statements or load them into memory on runtime. Using this utility you may
  9. create a object file from your data file and just link program and data
  10. together.
  11.  
  12. SYNTAX:
  13.  DataToObject [datafile] [objectfile] [variablename] [-c] [-f]
  14.  
  15. where:
  16.  datafile     is the file containing your data,
  17.  objectfile   is the file to be created,
  18.  variablename the name of the variable you intent to use to access the data,
  19.  -c           if the data has to be loaded into CHIP-Ram,
  20.  -f           if the data has to be loaded into FAST-Ram.
  21.  
  22.  If a parameter is missing, the program has been called from Workbench or an
  23. error occured during execution, you will get a requester to enter/modify your
  24. parameters.
  25.  
  26.  The resulting object file contains another variable named variablename+'len'
  27. (i.e. '_test' would produce '_testlen'), where the length of your data is
  28. stored (the variable is a long int, the size is in bytes).
  29.  
  30. Short example how to access your data from C and asm:
  31.  
  32. Suppose you have written a long text with your favorite editor (DME) and
  33. filed under the name 'text'.
  34.  
  35. Now call this program:
  36.  DataToObject text text.obj _text
  37.  
  38. This should produce a file called text.o.
  39. The C source to print out your text may look like this:
  40.  
  41. extern char text;
  42. extern long textlen;
  43.  
  44. main()
  45. {
  46.  Write(Output(),&text,textlen);
  47. }
  48.  
  49.  
  50. Same in assembler:
  51.  
  52.    XREF   _text
  53.    XREF   _textlen
  54.    XREF   _DOSBase
  55.    XREF   _LVOOutput
  56.    XREF   _LVOWrite
  57.  
  58.    move.l _DOSBase,a6
  59.    jsr    _LVOOutput(a6)
  60.    move.l #_text,d2
  61.    move.l _textlen,d3
  62.    jmp    _LVOWrite(a6)
  63.    END
  64.  
  65. Now the bad news: It does not work with Lattice C!
  66.  
  67. Werner Gunther (g35@DHDURZ1.BITNET)
  68.  
  69.